package cn.mehoyo.certificateGeneration.service;

import cn.mehoyo.certificateGeneration.entity.CertificateResult;
import cn.mehoyo.certificateGeneration.entity.DnsChallengeInfo;
import cn.mehoyo.certificateGeneration.enums.ACME;
import org.noear.solon.validation.annotation.NotNull;

public interface CertificateService {

    /**
     * 获取指定域名的DNS质询信息
     *
     * @param domain 域名
     * @param acme 服务商
     * @param eabKid External Account Binding ID （ZeroSSL必填）
     * @param eabHmacKey 绑定密钥 （ZeroSSL必填）
     * @return 返回域名对应的DNS质询信息
     * @throws Exception exception
     */
    DnsChallengeInfo getDnsChallengeInfo(@NotNull String domain, @NotNull ACME acme, String eabKid, String eabHmacKey) throws Exception;

    /**
     * 执行验证并生成证书
     * @param domain 需要生成证书的域名
     * @return CertificateResult
     * @throws Exception exception
     */
    CertificateResult generateCertificate(@NotNull String domain) throws Exception;

    /**
     * 续签证书
     * @param domain 域名
     * @return CertificateResult
     * @throws Exception exception
     */
    CertificateResult renewCertificate(String domain) throws Exception;

}
